import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 库房列表信息 */
export interface Warehouse {
          id: number; // 编号
          warehouseName?: string; // 库房名称
          type?: number; // 库房类型
          capacity?: number; // 库房规格
          usedCount?: number; // 已使用数量
          status?: number; // 使用状态
          address?: string; // 库房地址
          remark: string; // 备注
          attachmentUrl: string; // 附件地址
  }

// 库房列表 API
export const WarehouseApi = {
  // 查询库房列表分页
  getWarehousePage: async (params: any) => {
    return await request.get({ url: `/warehouse/warehouse/page`, params })
  },

  // 查询库房列表详情
  getWarehouse: async (id: number) => {
    return await request.get({ url: `/warehouse/warehouse/get?id=` + id })
  },

  // 新增库房列表
  createWarehouse: async (data: Warehouse) => {
    return await request.post({ url: `/warehouse/warehouse/create`, data })
  },

  // 修改库房列表
  updateWarehouse: async (data: Warehouse) => {
    return await request.put({ url: `/warehouse/warehouse/update`, data })
  },

  // 删除库房列表
  deleteWarehouse: async (id: number) => {
    return await request.delete({ url: `/warehouse/warehouse/delete?id=` + id })
  },

  /** 批量删除库房列表 */
  deleteWarehouseList: async (ids: number[]) => {
    return await request.delete({ url: `/warehouse/warehouse/delete-list?ids=${ids.join(',')}` })
  },

  // 导出库房列表 Excel
  exportWarehouse: async (params) => {
    return await request.download({ url: `/warehouse/warehouse/export-excel`, params })
  },
}